package com.pactera.config;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.pactera.common.database.DynamicDataSourceRegister;


/**
 * SprigBoot应用启动配置
 * @author lee
 */
@SpringBootApplication
@EnableTransactionManagement
@EnableRedisHttpSession
@ComponentScan(basePackages ={"com.pactera"})	
@MapperScan("com.pactera.mapper")
@Import({DynamicDataSourceRegister.class})
public class WebApplication  extends SpringBootServletInitializer {

	/**
     * 实现SpringBootServletInitializer
     * 可以让spring-boot项目在web容器中运行 
     */  
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		builder.sources(this.getClass());
		return super.configure(builder);
	}  

	public static void main(String[] args) {
		SpringApplication.run(WebApplication.class, args);
	}
}
